package cn.just.controller;

import cn.just.entity.User;
import cn.just.utils.THUtils;
import org.thymeleaf.context.Context;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author wujiaming
 */
@WebServlet(name = "SendServlet",value = "/SendServlet")
public class SendServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        //显示send.html
        Context context = new Context();

        //将用户的信息填入页面中
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute("user");
        context.setVariable("userName",user.getUserName());
        THUtils.write("blog/send",context,response);
    }
}
